// src\router\index.ts
import { createRouter, RouteRecordRaw, createWebHistory } from 'vue-router'

const routes: RouteRecordRaw[] = [
  {
    path: '/',
    redirect: '/home'
  },
  {
    path: '/',
    component: () => import('@/components/Layout/index.vue'),
    children: [
      {
        path: '/home',
        name: 'home',
        component: () => import('@/views/Home.vue')
      },
      {
        path: '/article/:pid',
        name: 'article',
        component: () => import('@/views/Article.vue')
      },
      {
        path: '/file',
        name: 'file',
        component: () => import('@/views/File.vue')
      },
      {
        path: '/content/:articleId',
        name: 'content',
        component: () => import('@/views/Content.vue')
      },
      {
        path: '/tag/:name',
        name: 'tag',
        component: () => import('@/views/Tag.vue')
      },
      {
        path: '/dynamic',
        name: 'dynamic',
        component: () => import('@/views/Dynamic.vue')
      }
    ]
  }
]

const router = createRouter({
  history: createWebHistory('/blog'),
  routes
})

export default router
